/*
 * @Description: 
 * @Author: diyhome
 * @Date: 2021-03-20 8:09
 * @File: EC20MQTT
*/
#include "EC20MQTT.h"
uint8_t recv_buf[RXBUF_LENGTH];
uint8_t is_uart_idle;

EC20StatusType EC20_Receive_Handler() {
    is_uart_idle = 1;
    return EC20_OK;
}

EC20StatusType EC20_MQTT_Init(void) {
    uint8_t timeout_state = 1;

    EC20_Send_Handler("AT\r\n");
    for (uint8_t i = 0; i < 200; ++i) {
        if (is_uart_idle && strcmp(recv_buf, "AT\r\nOK\r\n")) {
            timeout_state = 0;
            break;
        }
    }
    if (timeout_state) return EC20_TIMEOUT;
    return EC20_OK;
}
